home *** CD-ROM | disk | FTP | other *** search
- ;
- ;this program tests the d2_hex subroutine
- ;
- ; written by
- ; John O. Battle, N4OE
- ; c/s 73547,3346
- ; 732A Holcomb Bridge Road
- ; Norcross, GA 30071
- ; (404) 449-8536
- ;
- page 62,132
-
- cseg segment para public 'code'
- assume cs:cseg,ds:cseg,es:cseg,ss:cseg
- org 100h
-
- begin:
-
- tester proc near
- assume cs:cseg,ds:cseg
- mov bx,cs
- mov ds,bx
- mov ax,0
- mov bx,0
- mov dx,0
- mov cx,17
- tt_1: push ax ;arg3 value
- push bx ;arg2 col
- push dx ;arg1 line
- call d2_hex
- add sp,6
- inc dx ;line
- inc bx ;col
- inc bx
- inc bx
- inc ax ;value
- loop tt_1
- int 20h
- tester endp
-
- daz proc near
- ;
- ;This function prints an ASCIIZ string to the monochrome screen.
- ;
- daz endp
-
-
- d2_hex proc near
- ;
- ;This subroutine writes hex values to the monochrome screen.
- ;The value is first pushed onto the stack, then the
- ;screen line and column numbers are pushed.
- ;Next, the function is called, and finally, the stack is fixed.
- ;
- ; push value
- ; push line
- ; push column
- ; call d2
- ; add sp,6 ;fix stack
- ;
- push ds ;10 pushes in all
- push es
- push ax
- push bx
- push cx
- push dx
- push si
- push di
- push bp
- pushf
-
- mov bp,sp ;get args from stack
- mov ax,[bp+22] ;arg 1 (2*10 pushes + 2*1)
- ;screen line number
- mov ah,0
- mov bx,80
- mul bx
- mov bx,[bp+24] ;arg 2 (2*10 pushes + 2*2)
- add ax,bx ;screen column number
- mov dx,ax
- shl dx,1 ;multiply by two
- mov di,dx
- mov bl,[bp+26] ;arg 3 (2*10 pushes + 2*3)
- push bx ;value of number to display
- mov dl,bl
- mov cl,4
- shr dl,cl ;get upper nibble
- add dl,30h ;convert to ascii
- cmp dl,03ah ;greater than 9?
- jl dx_1
- add dl,7 ;yes, then add 7
- dx_1:
- mov dh,7
- mov bx,0b000h ;monochrome display memory segment
- mov ds,bx
- mov ds:[di],dx ;send to screen
- pop bx
- mov dl,bl
- and dl,0fh
- add dl,30h
- cmp dl,03ah
- jl dx_2
- add dl,7
- dx_2:
- mov dh,7
- mov bx,0b000h ;monochrome display memory segment
- mov ds,bx
- mov ds:[di+2],dx
-
- popf
- pop bp
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- pop es
- pop ds
- ret
-
- d2_hex endp
-
- cseg ends
- end begin